@(ptui: models.user.PortraitUserInfo,lui: models.user.LinkUserInfo)
@js_css={
<script type="text/javascript">
<!--
 $("document").ready(function(){
	 //tab页锁定
	 var Request = new Object();
	 Request = GetRequest();
	 var tab = Request['tab'];
	 if(tab=='email'){
		 $("#tab_"+tab).click(); 
	 }else if(tab=='password'){
		 $("#tab_"+tab).click(); 
	 }else{
		 $("#tab_mobile").click(); 
	 }
	 
	 $("#bemail-btn").click(function(){
			var email = $("#email").val();
			var email_reg = /\w@@\w*\.\w/;
			
			if(email == null || email == ""){
				prompt_pos("bemail","电子邮箱不能为空");
				return false;
			}
			if(!email_reg.test(email)){
				prompt_pos("bemail","电子邮箱格式不正确");
				return false;
			}
			
		});
	 
	 $("#bmobile-btn").click(function(){
			var mobile = $("#mobile").val();
			var mobile_reg = /1[3-8]+\d{9}/;
			var mobile_reg1 = /^(13[0-9]{9})| (18[0-9]{9}) |(15[89][0-9]{8})$/;
			
			if(mobile == null || mobile == ""){
				prompt_pos("bmobile","手机号码不能为空");
				return false;
			}
			if(!mobile_reg.test(mobile)){
				prompt_pos("bmobile","手机号码格式不正确");
				return false;
			}
			
			
		});
	 
	 $("#mpwd-btn").click(function(){
			var password = $("#password").val();
			var repassword = $("#repassword").val();
			if(password == null || password == ""){
				prompt_pos("mpwd","请填写新密码");
				return false;
			}else {
				if(password.length<6){
					prompt_pos("mpwd","密码不能少于6位");
					return false;
				}
				if(repassword==null||repassword==""){
					prompt_pos("mpwd","重复密码不能为空");
					return false;
				}
				if(password != repassword){
					prompt_pos("mpwd","两次密码不一致");
					return false;
				}
			}
			
		});
	 
 });
//-->
</script>
}
@main("个人中心",js_css) {
<div class="col-xs-10 col-md-10 col-xs-offset-1">

	<div class="panel panel-default">
		<div class="panel-heading">
			<h3 class="panel-title">安全设置</h3>
		</div>
		<div class="panel-body">
			<div class="col-xs-2 col-md-2">
				<div class="col-xs-12">
					<a class="thumbnail" href="#"> <img alt="100%x180"
						data-src="./js/holder.min.js/100%x180"
						@if(ptui.portrait == null || ptui.portrait == ""){
							src="http://meng-user.qiniudn.com/pic.png"
						}else{
							src="@ptui.portrait"
						}>
					</a>
				</div>
				<div class="col-xs-12 col-md-12">
					<div class="col-xs-10 col-xs-offset-1">@session().get("username")</div>
				</div>
			</div>
			<div class="col-xs-10">
				<ul class="nav nav-tabs" style="margin-bottom: 15px;">
					<li class="active"><a href="#mmobile" id="tab_mobile" data-toggle="tab">绑定手机号</a></li>
					<li class=""><a href="#memail" id="tab_email" data-toggle="tab">绑定邮箱</a></li>
					<li class=""><a href="#mpassword" id="tab_password" data-toggle="tab">修改密码</a></li>
				</ul>
				<div id="myTabContent" class="tab-content">

					<div class="tab-pane fade active in" id="mmobile">
						<div class="col-xs-12">
							<div class="col-lg-8">
								<form class="form-horizontal" method="post" action="/user/link/mobile/active">
									<fieldset>
										<h4>绑定手机号</h4>
										<div class="col-xs-12">
											<div id="bmobile_prompt" class="alert alert-dismissable alert-warning hide">
									  			<p><b></b></p>
											</div>
										</div>
										<div class="form-group">
											<label for="mobile" class="col-lg-2 control-label">手机号</label>
						
											<div class="col-lg-10">
												<input class="form-control" name="mobile" 
												@if(lui.mobile_status){ disabled } 
												id="mobile" placeholder="手机号" type="text" value="@lui.mobile">
											</div>
										</div>
										<div class="form-group">
											<div class="col-lg-4 col-lg-offset-4">
												<button id="bmobile-btn" type="submit"
												@if(lui.mobile_status){ disabled }
												 class="btn btn-primary">
												@if(lui.mobile_status){ 已绑定 }else{绑定}
												</button>
											</div>
										</div>
									</fieldset>
								</form>
							</div>
						</div>
					</div>
					<div class="tab-pane fade" id="memail">
						<div class="col-xs-12">
							<div class="col-lg-8">
								<form class="form-horizontal" method="post" action="/user/link/email/active">
										<fieldset>
											<h4>绑定邮箱</h4>
											<div class="col-xs-12">
												<div id="bemail_prompt" class="alert alert-dismissable alert-warning hide">
										  			<p><b></b></p>
												</div>
											</div>
											<div class="form-group">
												<label for="email" class="col-lg-2 control-label">邮箱</label>
							
												<div class="col-lg-10">
													<input class="form-control" name="email"
													@if(lui.email_status){ disabled }
													id="email" placeholder="邮箱" type="text" value="@lui.email">
												</div>
											</div>
											<div class="form-group">
												<div class="col-lg-4 col-lg-offset-4">
													<button id="bemail-btn" type="submit" 
													@if(lui.email_status){ disabled }
													class="btn btn-primary">
														@if(lui.email_status){ 已绑定 }else{绑定}
													</button>
												</div>
											</div>
										</fieldset>
									</form>
							</div>
						</div>
					</div>
					<div class="tab-pane fade" id="mpassword">
						<div class="col-xs-12">
						<div class="col-lg-8">
							<form class="form-horizontal" method="post" action="/user/modifypwd">
									<fieldset>
										<h4>修改密码</h4>
										<div class="col-xs-12">
											<div id="mpwd_prompt" class="alert alert-dismissable alert-warning hide">
									  			<p><b></b></p>
											</div>
										</div>
										<div class="form-group">
											<label for="password" class="col-lg-2 control-label">新密码</label>
						
											<div class="col-lg-10">
												<input class="form-control" name="password" id="password" placeholder="最少6位" type="password">
											</div>
										</div>
										<div class="form-group">
											<label for="repassword" class="col-lg-2 control-label">重复密码</label>
						
											<div class="col-lg-10">
												<input class="form-control" name="repassword" id="repassword" placeholder="重复密码" type="password">
											</div>
										</div>
										<div class="form-group">
											<div class="col-lg-4 col-lg-offset-4">
												<button id="mpwd-btn" type="submit" class="btn btn-primary">修改</button>
											</div>
										</div>
									</fieldset>
								</form>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
}
